home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-12 | 2.0 KB | 101 lines | [TEXT/CWIE] |
- unit WEICSupport;
-
- { WASTE DEMO PROJECT: }
- { Internet Config Support }
-
- { Copyright © 1995 Marco Piovanelli }
- { All Rights Reserved }
-
- interface
- uses
- WASTE;
-
- { ICAwareWEClick is a version of WEClick which supports command+clicking of URLs }
- { through Internet Config }
-
- procedure ICAwareWEClick (hitPt: Point;
- modifiers: Integer;
- clickTime: LongInt;
- we: WEReference);
-
- implementation
- uses
- ICAPI, LowMem;
-
- procedure ICAwareWEClick (hitPt: Point;
- modifiers: Integer;
- clickTime: LongInt;
- we: WEReference);
- label
- 1;
- const
- kGenericCreator = '????';
- var
- ic: ICInstance;
- hText: Handle;
- selStart, selEnd: LongInt;
- junklong: LongInt;
- i: Integer;
- saveTextState: SignedByte;
- err: ICError;
- begin
- ic := nil;
-
- { first let WEClick do its thing }
- WEClick(hitPt, modifiers, clickTime, we);
-
- { if this isn't a command+click in an active WE instance, we're finished }
- if (BAND(modifiers, cmdKey) = 0) | (WEIsActive(we) = false) then
- goto 1;
-
- { try to start start Internet Config }
- err := ICStart(ic, kGenericCreator);
- if (err <> noErr) then
- goto 1;
-
- { find the IC preferences file }
- err := ICFindConfigFile(ic, 0, nil);
- if (err <> noErr) then
- goto 1;
-
- { get current selection range }
- WEGetSelection(selStart, selEnd, we);
-
- { get a handle to the raw text }
- hText := WEGetText(we);
-
- { lock it }
- saveTextState := HGetState(hText);
- HLock(hText);
-
- { parse the URL and fetch it using the appropriate helper application }
- err := ICLaunchURL(ic, '', hText^, GetHandleSize(hText), selStart, selEnd);
-
- { unlock the text }
- HSetState(hText, saveTextState);
-
- { highlight the URL }
- WESetSelection(selStart, selEnd, we);
-
- { flash the URL if successful }
- if (err = noErr) then
- begin
- for i := LMGetMenuFlash - 1 downto 0 do
- begin
- Delay(5, junklong);
- WEDeactivate(we);
- Delay(5, junklong);
- WEActivate(we);
- end; { for }
- end
- else
- SysBeep(30);
-
- 1:
- { clean up }
- if (ic <> nil) then
- if (ICStop(ic) <> noErr) then
- ;
- end; { ICAwareWEClick }
-
- end.